﻿<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>CloudBOX | 我的</title>
    <link rel="shortcut icon" href="assets/images/logo_ico.png" type="img/png"/>
    <link rel="stylesheet" href="assets/css/backend.min.css">
    <link rel="stylesheet" href="assets/vendor/@fortawesome/fontawesome-free/css/all.min.css">
    <link rel="stylesheet" href="assets/vendor/line-awesome/dist/line-awesome/css/line-awesome.min.css">
    <link rel="stylesheet" href="assets/vendor/remixicon/fonts/remixicon.css">
    <link rel="stylesheet" href="assets/vendor/doc-viewer/include/pdf/pdf.viewer.css">
    <link rel="stylesheet" href="assets/vendor/doc-viewer/include/PPTXjs/css/pptxjs.css">
    <link rel="stylesheet" href="assets/vendor/doc-viewer/include/PPTXjs/css/nv.d3.min.css">
    <link rel="stylesheet" href="assets/vendor/doc-viewer/include/SheetJS/handsontable.full.min.css">
    <link rel="stylesheet" href="assets/vendor/doc-viewer/include/verySimpleImageViewer/css/jquery.verySimpleImageViewer.css">
    <link rel="stylesheet" href="assets/vendor/doc-viewer/include/officeToHtml/officeToHtml.css">
    <link rel="stylesheet" href="assets/vendor/notice/css/bs4.pop.css">
</head>
<body class="  ">
<!-- 加载动画开始 -->
<div id="loading">
    <div id="loading-center">
    </div>
</div>
<!-- 加载动画结束 -->

<!-- 左侧导航栏开始 -->
<div class="iq-sidebar  sidebar-default ">
    <div class="iq-sidebar-logo d-flex align-items-center justify-content-between">
        <a href="page-index.html" class="header-logo">
            <img src="assets/images/logo.png" class="img-fluid rounded-normal light-logo" alt="logo">
            <img src="assets/images/logo-white.png" class="img-fluid rounded-normal darkmode-logo" alt="logo">
        </a>
        <div class="iq-menu-bt-sidebar">
            <i class="las la-bars wrapper-menu"></i>
        </div>
    </div>
    <div class="data-scrollbar" data-scroll="1">
        <div class="new-create select-dropdown input-prepend input-append">
            <div class="btn-group">
                <label data-toggle="dropdown">
                    <div class="search-query selet-caption"><i class="las la-plus pr-2"></i>操 作</div><span class="search-replace"></span>
                    <span class="caret"> </span>
                </label>
                <ul class="dropdown-menu">
                    <a href="upload-picture.html"><li><div class="item"><i class="ri-file-upload-line pr-3"></i>上传图片</div></li></a>
                    <a href="upload-document.html"><li><div class="item"><i class="ri-file-upload-line pr-3"></i>上传文档</div></li></a>
                    <a href="upload-audio.html"><li><div class="item"><i class="ri-file-upload-line pr-3"></i>上传音频</div></li></a>
                    <a href="upload-video.html"><li><div class="item"><i class="ri-file-upload-line pr-3"></i>上传视频</div></li></a>
                </ul>
            </div>
        </div>
        <nav class="iq-sidebar-menu">
            <ul id="iq-sidebar-toggle" class="iq-menu">
                <li class=" ">
                    <a href="page-index.html" class="">
                        <i class="las la-home iq-arrow-left"></i><span>主页</span>
                    </a>
                    <ul id="dashboard" class="iq-submenu collapse" data-parent="#iq-sidebar-toggle">
                    </ul>
                </li>
                <li class=" ">
                    <a href="#mydrive" class="collapsed" data-toggle="collapse" aria-expanded="false">
                        <i class="las la-hdd"></i><span>空间</span>
                        <i class="las la-angle-right iq-arrow-right arrow-active"></i>
                        <i class="las la-angle-down iq-arrow-right arrow-hover"></i>
                    </a>
                    <ul id="mydrive" class="iq-submenu collapse" data-parent="#iq-sidebar-toggle">
                        <li class=" ">
                            <a href="page-picture.html">
                                <i class="lab la-blogger-b"></i><span>图片</span>
                            </a>
                        </li>
                        <li class=" ">
                            <a href="page-document.html">
                                <i class="las la-share-alt"></i><span>文档</span>
                            </a>
                        </li>
                        <li class=" ">
                            <a href="page-audio.html">
                                <i class="las la-icons"></i><span>音频</span>
                            </a>
                        </li>
                        <li class=" ">
                            <a href="page-video.html">
                                <i class="las la-icons"></i><span>视频</span>
                            </a>
                        </li>
                    </ul>
                </li>
                <li class=" ">
                    <a href="page-message.html" class="">
                        <i class="lar la-file-alt iq-arrow-left"></i><span>发现</span>
                    </a>
                    <ul id="page-files" class="iq-submenu collapse" data-parent="#iq-sidebar-toggle">
                    </ul>
                </li>
                <li class="">
                    <a href="page-record.html" class="">
                        <i class="las la-stopwatch iq-arrow-left"></i><span>最近</span>
                    </a>
                    <ul id="page-folders" class="iq-submenu collapse" data-parent="#iq-sidebar-toggle">
                    </ul>
                </li>
                <li class=" ">
                    <a href="page-collection.html" class="">
                        <i class="lar la-star"></i><span>收藏</span>
                    </a>
                    <ul id="page-fevourite" class="iq-submenu collapse" data-parent="#iq-sidebar-toggle">
                    </ul>
                </li>
                <li class=" ">
                    <a href="page-trash.html" class="">
                        <i class="las la-trash-alt iq-arrow-left"></i><span>回收</span>
                    </a>
                    <ul id="page-delete" class="iq-submenu collapse" data-parent="#iq-sidebar-toggle">
                    </ul>
                </li>
                <li class=" ">
                    <a href="page-user.html">
                        <i class="las la-user-cog iq-arrow-left"></i><span>我的</span>
                    </a>
                </li>
            </ul>
        </nav>

        <div class="p-3" id="space"></div>
    </div>
</div>
<!-- 左侧导航栏结束 -->


<!-- 顶部导航栏开始 -->
<div class="iq-top-navbar">
    <div class="iq-navbar-custom">
        <nav class="navbar navbar-expand-lg navbar-light p-0">
            <div class="iq-navbar-logo d-flex align-items-center justify-content-between">
                <i class="ri-menu-line wrapper-menu"></i>
                <a href="page-index.html" class="header-logo">
                    <img src="assets/images/logo.png" class="img-fluid rounded-normal light-logo" alt="logo">
                    <img src="assets/images/logo-white.png" class="img-fluid rounded-normal darkmode-logo" alt="logo">
                </a>
            </div>

            <!-- 搜索开始 -->
            <div class="iq-search-bar device-search">
                <form>
                    <div class="input-prepend input-append">
                        <div class="btn-group">
                            <label class="dropdown-toggle searchbox" data-toggle="dropdown">
                                <input class="dropdown-toggle search-query text search-input" readonly autocomplete="off" type="text" id="content" placeholder="搜索"><span class="search-replace"></span>
                                <a class="search-link" href="javascript:void(0);" id="search"><i class="ri-search-line"></i></a>
                                <span class="caret"></span>
                            </label>
                            <ul class="dropdown-menu">
                                <li><a href="page-document.html?documentType=pdf"><div class="item"><i class="far fa-file-pdf bg-info"></i>PDF</div></a></li>
                                <li><a href="page-document.html?documentType=doc"><div class="item"><i class="far fa-file-alt bg-primary"></i>DOC</div></a></li>
                                <li><a href="page-document.html?documentType=xls"><div class="item"><i class="far fa-file-excel bg-success"></i>XLS</div></a></li>
                                <li><a href="page-document.html?documentType=ppt"><div class="item"><i class="far fa-file-powerpoint bg-danger"></i>PPT</div></a></li>
                                <li><a href="page-picture.html"><div class="item"><i class="far fa-file-image bg-warning"></i>Image</div></a></li>
                                <li><a href="page-video.html"><div class="item"><i class="far fa-file-video bg-info"></i>Video</div></a></li>
                            </ul>
                        </div>
                    </div>
                </form>
            </div>
            <!-- 搜索结束 -->

            <!-- 个人中心开始 -->
            <div class="d-flex align-items-center">
                <div class="change-mode">
                    <div class="custom-control custom-switch custom-switch-icon custom-control-inline">
                        <div class="custom-switch-inner">
                            <p class="mb-0"> </p>
                            <input type="checkbox" class="custom-control-input" id="dark-mode" data-active="true">
                            <label class="custom-control-label" for="dark-mode" data-mode="toggle">
                                <span class="switch-icon-left"><i class="a-left"></i></span>
                                <span class="switch-icon-right"><i class="a-right"></i></span>
                            </label>
                        </div>
                    </div>
                </div>
                <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"  aria-label="Toggle navigation">
                    <i class="ri-menu-3-line"></i>
                </button>
                <div class="collapse navbar-collapse" id="navbarSupportedContent">
                    <ul class="navbar-nav ml-auto navbar-list align-items-center">
                        <li class="nav-item nav-icon search-content">
                            <a href="#" class="search-toggle rounded" id="dropdownSearch" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                <i class="ri-search-line"></i>
                            </a>
                            <div class="iq-search-bar iq-sub-dropdown dropdown-menu" aria-labelledby="dropdownSearch">
                                <form action="#" class="searchbox p-2">
                                    <div class="form-group mb-0 position-relative">
                                        <input type="text" class="text search-input font-size-12" placeholder="type here to search...">
                                        <a href="#" class="search-link"><i class="las la-search"></i></a>
                                    </div>
                                </form>
                            </div>
                        </li>
                        <li class="nav-item nav-icon dropdown">
                            <a href="#" class="search-toggle dropdown-toggle" id="dropdownMenuButton02" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" >
                                <i class="ri-settings-3-line"></i>
                            </a>
                            <div class="iq-sub-dropdown dropdown-menu" aria-labelledby="dropdownMenuButton02">
                                <div class="card shadow-none m-0">
                                    <div class="card-body p-0 ">
                                        <div class="p-3">
                                            <a href="auth-lock-screen.html" class="iq-sub-card pt-0"><i class="ri-settings-3-line"></i>锁屏</a>
                                        </div>
                                        <div class="p-3">
                                            <a href="page-user.html" class="iq-sub-card pt-0"><i class="ri-settings-3-line"></i>个人中心</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </li>
                        <li class="nav-item nav-icon dropdown caption-content">
                            <a href="#" class="search-toggle dropdown-toggle" id="dropdownMenuButton03" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" >
                                <div class="caption bg-primary line-height">
                                    <img id="head1" style="width: 28px" src="">
                                </div>
                            </a>
                            <div class="iq-sub-dropdown dropdown-menu" aria-labelledby="dropdownMenuButton03">
                                <div class="card mb-0">
                                    <div class="card-header d-flex justify-content-between align-items-center mb-0">
                                        <div class="header-title">
                                            <h4 class="card-title mb-0">欢迎使用</h4>
                                        </div>
                                        <div class="close-data text-right badge badge-primary cursor-pointer "><i class="ri-close-fill"></i></div>
                                    </div>
                                    <div class="card-body">
                                        <div class="profile-header">
                                            <div class="cover-container text-center">
                                                <div class="rounded-circle profile-icon bg-primary mx-auto d-block">
                                                    <a href="page-user.html">
                                                        <img id="head2" style="width: 66px;" src="">
                                                    </a>
                                                </div>
                                                <div class="profile-detail mt-3">
                                                    <h5><a href="page-user.html" id="username"></a></h5>
                                                </div>
                                                <p></p>
                                                <a href="javascript:void(0);" id="exit" class="btn btn-primary">退出登录</a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
            <!-- 个人中心结束 -->
        </nav>
    </div>
</div>
<!-- 顶部导航栏结束 -->


<!-- 正文开始 -->
<div class="content-page">
    <div class="container-fluid">
        <div class="row">

            <div class="col-lg-12">
                <div class="d-flex align-items-center justify-content-between welcome-content mb-3">
                    <div class="navbar-breadcrumb">
                        <nav aria-label="breadcrumb">
                            <ul class="breadcrumb">
                                <li class="breadcrumb-item"><a href="page-index.html">主页</a></li>
                                <li class="breadcrumb-item active" aria-current="page"><a href="page-user.html">我的</a></li>
                            </ul>
                        </nav>
                    </div>
                </div>
            </div>

            <div class="col-lg-12">
                <div class="card">
                    <div class="card-body p-0">
                        <div class="iq-edit-list usr-edit">
                            <ul class="iq-edit-profile d-flex nav nav-pills">
                                <li class="col-md-6 p-0">
                                    <a class="nav-link active" data-toggle="pill" href="#personal-information">
                                        个人信息
                                    </a>
                                </li>
                                <li class="col-md-6 p-0">
                                    <a class="nav-link" data-toggle="pill" href="#chang-pwd">
                                        修改密码
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-lg-12">
                <div class="iq-edit-list-data">
                    <div class="tab-content">
                        <div class="tab-pane fade active show" id="personal-information" role="tabpanel">
                            <div class="card">
                                <div class="card-header d-flex justify-content-between">
                                    <div class="iq-header-title">
                                        <h4 class="card-title">个人信息</h4>
                                    </div>
                                </div>
                                <div class="card-body">
                                    <form>
                                        <div class="form-group row align-items-center">
                                            <div class="col-md-12">
                                                <div class="profile-img-edit">
                                                    <div class="crm-profile-img-edit">
                                                        <img class="crm-profile-pic rounded-circle avatar-100" id="picPath" src="" alt="profile-pic">
                                                        <div class="crm-p-image bg-primary">
                                                            <i class="las la-pen upload-button"></i>
                                                            <input class="file-upload" type="file" id="head" accept="image/*">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class=" row align-items-center">
                                            <div class="form-group col-sm-6">
                                                <label for="uname">账号:</label>
                                                <input type="text" class="form-control" id="uname" readonly value="">
                                            </div>
                                            <div class="form-group col-sm-6">
                                                <label for="mobile">手机号:</label>
                                                <input  class="form-control" id="mobile" readonly value="">
                                            </div>
                                            <div class="form-group col-sm-6">
                                                <label for="name">昵称:</label>
                                                <input type="text" class="form-control" id="name" value="">
                                            </div>
                                            <div class="form-group col-sm-6">
                                                <label for="loc_province">省份:</label>
                                                <select class="form-control" id="loc_province"></select>
                                            </div>
                                            <div class="form-group col-sm-6">
                                                <label class="d-block">性别:</label>
                                                <div class="custom-control custom-radio custom-control-inline">
                                                    <input type="radio" id="man" name="sex" class="custom-control-input">
                                                    <label class="custom-control-label" for="man"> 男 </label>
                                                </div>
                                                <div class="custom-control custom-radio custom-control-inline">
                                                    <input type="radio" id="women" name="sex" class="custom-control-input">
                                                    <label class="custom-control-label" for="women"> 女 </label>
                                                </div>
                                            </div>

                                            <div class="form-group col-sm-6">
                                                <label for="loc_city">城市:</label>
                                                <select class="form-control" id="loc_city"></select>
                                            </div>
                                        </div>
                                        <button type="button" id="edit" class="btn btn-primary mr-2">确认编辑</button>
                                    </form>
                                </div>
                            </div>
                        </div>
                        <div class="tab-pane fade" id="chang-pwd" role="tabpanel">
                            <div class="card">
                                <div class="card-header d-flex justify-content-between">
                                    <div class="iq-header-title">
                                        <h4 class="card-title">修改密码</h4>
                                    </div>
                                </div>
                                <div class="card-body">
                                    <form>
                                        <div class="form-group">
                                            <label for="oldPwd">当前密码:</label>
                                            <input type="Password" class="form-control" id="oldPwd" value="">
                                        </div>
                                        <div class="form-group">
                                            <label for="newPwd">新的密码:</label>
                                            <input type="Password" class="form-control" id="newPwd" value="">
                                        </div>
                                        <div class="form-group">
                                            <label for="confirmPwd">确认密码:</label>
                                            <input type="Password" class="form-control" id="confirmPwd" value="">
                                        </div>
                                        <button type="button" id="updatePwd" class="btn btn-primary mr-2">确认修改</button>
                                        <button type="reset" class="btn iq-bg-danger">取消修改</button>
                                    </form>
                                </div>
                            </div>
                        </div>


                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 正文结束 -->


</div>
</div>

<!-- 页脚开始 -->
<footer class="iq-footer">
    <div class="container-fluid">
        <div class="row">
            <div class="col-lg-6">
                <ul class="list-inline mb-0">
                    <li class="list-inline-item"><a href="page-index.html">© www.gaoyiguan.cn - </a></li>
                    <li class="list-inline-item"><a href="page-index.html">网上云盘-毕设项目-高以官 © 版权所有</a></li>
                </ul>
            </div>
            <div class="col-lg-6 text-right">
                Copyright 2021 <a href="page-index.html">Cloud BOX</a> All Rights Reserved.
            </div>
        </div>
    </div>
</footer>
<!-- 页脚结束 -->
<script src="assets/js/jquery-1.8.3.min.js"></script>
<script src="assets/js/backend-bundle.min.js"></script>
<script src="assets/js/customizer.js"></script>
<script src="assets/js/chart-custom.js"></script>
<script src="assets/vendor/doc-viewer/include/pdf/pdf.js"></script>
<script src="assets/vendor/doc-viewer/include/docx/jszip-utils.js"></script>
<script src="assets/vendor/doc-viewer/include/docx/mammoth.browser.min.js"></script>
<script src="assets/vendor/doc-viewer/include/PPTXjs/js/filereader.js"></script>
<script src="assets/vendor/doc-viewer/include/PPTXjs/js/d3.min.js"></script>
<script src="assets/vendor/doc-viewer/include/PPTXjs/js/nv.d3.min.js"></script>
<script src="assets/vendor/doc-viewer/include/PPTXjs/js/pptxjs.js"></script>
<script src="assets/vendor/doc-viewer/include/PPTXjs/js/divs2slides.js"></script>
<script src="assets/vendor/doc-viewer/include/SheetJS/handsontable.full.min.js"></script>
<script src="assets/vendor/doc-viewer/include/SheetJS/xlsx.full.min.js"></script>
<script src="assets/vendor/doc-viewer/include/verySimpleImageViewer/js/jquery.verySimpleImageViewer.js"></script>
<script src="assets/vendor/doc-viewer/include/officeToHtml/officeToHtml.js"></script>
<script src="assets/js/doc-viewer.js"></script>
<script src="assets/js/app.js"></script>
<script src="assets/vendor/notice/js/bs4.pop.js"></script>
<script src="assets/vendor/notice/bootstrap-4.0.0-dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="assets/vendor/area/area.js"></script>
<script type="text/javascript" src="assets/vendor/area/location.js"></script>
<script type="text/javascript">

    //云盘容量信息
    spaceInfo();

    //用户信息
    userInfo();


    /**
     * 头像上传
     */
    $("#head").change(function () {
        var formData = new FormData();
        formData.append("file",$("#head")[0].files[0]);
        console.info(formData);
        $.ajax({
            url:'cloud-user/upload',
            type: 'post',
            data:  formData,
            processData: false,
            contentType: false,
            dataType: 'json',
            success: function (result) {
                if (result.code == 200) {
                    $("#picPath").prop("src", result.data);
                }
            }
        });
    });

    /**
     * 确认编辑
     */
    $("#edit").click(function () {
        let picPath = $("#picPath").prop("src");
        let name = $("#name").val();

        var options=$('#loc_province option:selected');
        let province = options.text();

        var cityOpt=$('#loc_city option:selected');
        let city = cityOpt.text();

        let sex = null;
        if ($("#man").prop("checked") == true) {
            sex = 1;
        }
        if ($("#women").prop("checked") == true) {
            sex = 2;
        }

        if (name == null || name == '') {
            bs4pop.notice("昵称不允许为空！", {type: 'danger', position: 'center'});
            return;
        }

        bs4pop.confirm('你确定要提交编辑信息吗？', function(sure){
            if (sure == false) return;

            $.ajax({
                url: 'cloud-user/update',
                data: {
                    name: name,
                    picPath:picPath,
                    province: province,
                    city: city,
                    sex: sex
                },
                type: 'put',
                dataType: 'json',
                success: function (result) {
                    if (result.code == 200) {
                        bs4pop.notice("编辑个人信息成功！", {type: 'success', position: 'center'});
                    }
                }
            });
        });
    });

    /**
     * 校验旧密码
     */
    $("#oldPwd").blur(function () {
        let oldPwd = $("#oldPwd").val();

        if (oldPwd == null || oldPwd == '') {
            bs4pop.notice("密码不能为空！", {type: 'danger', position: 'center'});
            return;
        }

        $.ajax({
            url:'cloud-user/checkPwd',
            type:'post',
            data:{
                password: oldPwd
            },
            dataType: 'json',
            success:function (result) {
                if (result.code == 200) {
                    if (result.data == false) {
                        $("#oldPwd").val("");
                        bs4pop.notice("密码输入错误！", {type: 'danger', position: 'center'});
                    }
                }
            }
        });
    });

    /**
     * 密码框校验
     */
    $("#newPwd").blur(function () {
        let newPwd = $("#newPwd").val();
        if (newPwd == null || newPwd == '') {
            bs4pop.notice("新密码不能为空！", {type: 'danger', position: 'center'});
            return;
        }

        if (newPwd.length < 6) {
            bs4pop.notice("新密码不能少于6位！", {type: 'danger', position: 'center'});
            return;
        }

        $.ajax({
            url:'cloud-user/checkPwd',
            type:'post',
            data:{
                password: newPwd
            },
            dataType: 'json',
            success:function (result) {
                if (result.code == 200) {
                    if (result.data == true) {
                        bs4pop.notice("新密码与旧密码相同！", {type: 'danger', position: 'center'});
                        $("#newPwd").val("");
                        return;
                    }
                }
            }
        });
    });

    /**
     * 校验确认密码
     */
    $("#confirmPwd").blur(function () {
        let newPwd = $("#newPwd").val();
        let confirmPwd = $("#confirmPwd").val();
        if (newPwd != confirmPwd) {
            bs4pop.notice("两次密码输入不一致！", {type: 'danger', position: 'center'});
            $("#confirmPwd").val("");
            return;
        }
    });

    /**
     * 修改密码
     */
    $("#updatePwd").click(function () {

        let oldPwd = $("#oldPwd").val();
        let newPwd = $("#newPwd").val();
        let confirmPwd = $("#confirmPwd").val();

        if (oldPwd == null || oldPwd == '') {
            bs4pop.notice("请输入密码！", {type: 'danger', position: 'center'});
            return;
        }

        if (newPwd == null || newPwd == '') {
            bs4pop.notice("请输入新密码！", {type: 'danger', position: 'center'});
            return;
        }

        if (confirmPwd == null || confirmPwd == '') {
            bs4pop.notice("请再次输入新密码！", {type: 'danger', position: 'center'});
            return;
        }


        bs4pop.confirm('你确定要修改密码吗？', function(sure){
            if (sure == false) return;

            $.ajax({
                url:'cloud-user/updatePwd',
                type: 'put',
                data:{
                    password: $("#confirmPwd").val()
                },
                dataType: "json",
                success: function (result) {
                    if (result.code == 200) {
                        bs4pop.notice("修改密码成功，即将重新登录！", {type: 'success', position: 'center'});
                        setTimeout(function () {
                            location.href = 'auth-sign-in.html';
                        }, 2200)
                    }
                }
            });
        });
    });

    /**
     * 查询云盘空间信息
     */
    function spaceInfo() {
        $.ajax({
            url: 'cloud-space/info',
            type: 'get',
            dataType: 'json',
            success: function (result) {
                if (result.code == 200) {
                    var data = result.data;
                    var percent = data.percent;
                    $("#space").before("");
                    var str = "<div class=\"sidebar-bottom\">\n" +
                        "         <h4 class=\"mb-3\"><i class=\"las la-cloud mr-2\"></i>网上云盘</h4>\n" +
                        "         <p>"+ data.usedSize +" / "+ data.totalSize +" 容量</p>\n" +
                        "         <div class='progress'>" +
                        "            <div class='progress-bar progress-bar-striped' role='progressbar' style='width: "+ percent +"%;' aria-valuenow='"+ percent +"' aria-valuemin='0' aria-valuemax='100'></div>"+
                        "         </div>" +
                        "         <p style='margin-top: 10px'>"+ percent +"% - "+ data.surplusSize +" 剩余</p>\n" + "</div>";
                    $("#space").before(str);

                }
            }
        });
    };

    /**
     * 退出登录
     */
    $("#exit").click(function () {
        bs4pop.confirm('你确定要退出登录吗？', function(sure){
            if (sure == false) return;

            $.ajax({
                url: 'cloud-user/exit',
                type: 'delete',
                dataType: 'json',
                success: function (result) {
                    if (result.code == 200) {
                        location.href = 'auth-sign-in.html';
                    }
                }
            });
        });
    });

    /**
     * 用户信息
     */
    function userInfo() {
        $.ajax({
            url: 'cloud-user/welcome',
            type: 'get',
            dataType: 'json',
            success:function (result) {
                if (result.code == 200) {
                    let user = result.data;
                    $("#username").html(user.name);
                    $("#head1").prop("src", user.picPath);
                    $("#head2").prop("src", user.picPath);

                    $("#picPath").prop("src", user.picPath);
                    $("#uname").val(user.username);
                    $("#mobile").val(user.mobile);
                    $("#name").val(user.name);
                    if (user.sex == 1) {
                       $("#man").prop("checked", true);
                    }else if (user.sex == 2) {
                        $("#women").prop("checked", true);
                    }
                    //初始化省市信息
                    showLocation(user.province , user.city , null)
                }
            }
        });
    };


</script>
</body>
</html>